package com.news.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


/**
 * 文件控制类
 * */
@Configuration
public class FileConfig implements WebMvcConfigurer {


    @Value("${com.cgx.file.baseFilePath}")
    private String baseFilePath;

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/file/**").addResourceLocations("file:"+baseFilePath);
        WebMvcConfigurer.super.addResourceHandlers(registry);
    }

}
